<template>
  <div class="goods-item">
    <img src="https://yanxuan-item.nosdn.127.net/310eac832a1d90fbea41c4e6a9e604e4.png" alt="">
    <p class="name ellipsis-2">户外快干轻巧遮阳帽</p>
    <p class="price">&yen;32</p>
    <p class="count">已有{{randomNum}}人评价</p>
    <a href="javascript:;" class="publish" v-if="currentType === 'to_comment'">发布评价</a>
    <a href="javascript:;" class="publish" v-if="currentType === 'finished_comment'">查看评价</a>
  </div>
</template>

<script>
import { ref } from 'vue'
export default {
  name: 'CommentGoodsItem',
  props: {
    currentType: {
      type: String,
      default: ''
    }
  },
  setup () {
    // 生成1-30以内的2位随机整数
    const randomNum = ref(null)
    randomNum.value = Math.round(Math.random() * 30)
    return { randomNum }
  }
}
</script>

<style lang="less" scoped>
.goods-item {
  widows: 216px;
  height: 341px;
  img {
    width: 150px;
    height: 150px;
  }
  .name {
    font-size: 16px;
    height: 44px;
    text-align: center;
  }
  .price {
    font-size: 18px;
    color: @priceColor;
    padding: 10px 0;
  }
  .count {
    color: #999;
    padding-bottom: 10px;
  }
  .publish {
    width: 100px;
    height: 32px;
    background: @xtxColor;
    color: #fff;
    text-align: center;
    line-height: 32px;
    display: inline-block;
    border-radius: 4px;
  }
}
</style>
